#include <iostream>
#include <algorithm>

using namespace std;
int datas[4], cnt = 0;
struct Res
{
    int y, m, d;
    bool operator<(const Res &r) const
    {
        if (r.y != y)
            return y < r.y;
        if (r.m != m)
            return m < r.m;
        return d < r.d;
    }
    bool operator==(const Res &r) const
    {
        return r.y == y && r.m == m && r.d == d;
    }
} res[30];
Res data1 = {1960, 01, 01}, data2 = {2059, 12, 31};
int months[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

bool check_vilad(int y, int m, int d)
{
    if (m == 0 || m > 12 || d == 0)
        return false;
    if (m != 2 && d > months[m])
        return false;
    if (m == 2)
    {
        int leap = y % 100 != 0 && y % 4 == 0 || y % 400 == 0;
        if (d > months[2] + leap)
            return false;
    }
    return true;
}
int main()
{
    int y, m, d;
    scanf("%d/%d/%d", &y, &m, &d);
    datas[0] = y, datas[1] = m, datas[2] = d;
    if (y >= 60 && check_vilad(1900 + y, m, d))
        res[cnt++] = {1900 + y, m, d};
    else if (y < 60 && check_vilad(2000 + y, m, d))
        res[cnt++] = {2000 + y, m, d};
    if (d >= 60 && check_vilad(1900 + d, y, m)) // 月 日 年
        res[cnt++] = {1900 + d, y, m};
    else if (d < 60 && check_vilad(2000 + d, y, m))
        res[cnt++] = {2000 + d, y, m};
    if (d >= 60 && check_vilad(1900 + d, m, y))
        res[cnt++] = {1900 + d, m, y};
    else if (d < 60 && check_vilad(2000 + d, m, y))
        res[cnt++] = {2000 + d, m, y};

    sort(res, res + cnt);

    // cout<<cnt<<endl;
    printf("%02d-%02d-%02d\n", res[0].y, res[0].m, res[0].d);
    for (int i = 1; i < cnt; i++)
    {
        Res temp = res[i];
        if (temp == res[i - 1])
            continue;
        printf("%02d-%02d-%02d\n", res[i].y, res[i].m, res[i].d);
    }

    return 0;
}